home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / NeoIntroTCL3.0 folder / TCL / NeoDemo / Source / CNDButton.cp next >
Encoding:
Text File  |  1993-05-29  |  1.4 KB  |  64 lines  |  [TEXT/KAHL]

  1. /****
  2.  * CNDButton.c
  3.  *
  4.  *  Copyright © 1992 NeoLogic Systems.  All rights reserved.
  5.  *
  6.  ****/
  7.  
  8. #include "NeoTypes.h"
  9. #include "CNDButton.h"
  10. #include "CNDImagePICT.h"
  11. #include "CNDImageTIFF.h"
  12. #include "CNDImageGIF.h"
  13. #include "CNeoDemoDoc.h"
  14. #include "CNeoDLOGDialog.h"
  15. #include "CNeoDialogText.h"
  16.  
  17. /* fill docs image array with all images that match the type in the popup
  18.        and the text in the 'keyword' edit box
  19. */
  20. void CNDButton::DoGoodClick(short whichPart)
  21. {
  22.     short            type;
  23.     long            length;                /* size of search text */
  24.     NeoID            classID;            /* get from type popup */
  25.     Handle            handle;                /* search key text handle */
  26.     CNeoDemoDoc *    document    = ((CNeoDemoDoc *)((CNeoDLOGDialog *)itsSupervisor)->itsSupervisor);
  27.     char            string[33];            /* get from 'keyword' box */
  28.  
  29.     /* get key to search for */
  30.     handle = document->fSearchText->GetTextHandle();
  31.     length = GetHandleSize(handle);
  32.     if (length) {
  33.         if (length > 32)
  34.             length = 32;
  35.         NeoBlockMove(*handle, string, length);
  36.     }
  37.     string[length] = 0;            /* zero delimited string */
  38.  
  39.     /* could strip leading/trailing blanks, here */
  40.  
  41.     /* get 'type' for searching */
  42.     type = document->getImageType();
  43.  
  44.     switch(type) {
  45.         case kNDImagePICT:
  46.             classID = kNDImagePICTID;
  47.             break;
  48.         case kNDImageTIFF:
  49.             classID = kNDImageTIFFID;
  50.             break;
  51.         case kNDImageGIF:
  52.             classID = kNDImageGIFID;
  53.             break;
  54.         case kNDImage:
  55.             classID = kNDImageID;
  56.             break;
  57.     }
  58.  
  59.     document->setSelectionByKeyword(classID, string);
  60. }
  61.  
  62.  
  63.  
  64.